<!DOCTYPE html>
<html>
    <head>
        <meta charset="UTF-8" />
        <title>1天气案例</title>
        <!-- 引入Vue -->
        <script type="text/javascript" src="../js/vue.js"></script>
    </head>
    <body>
        <!-- 准备好一个容器-->
        <div id="demo">
            <h1>今天天气很{{info}}</h1>
            <button @click="changeWeather">切换天气</button>
        </div>
    </body>

    <script type="text/javascript">
        //阻止 vue 在启动时生成生产提示。
        Vue.config.productionTip = false
        new Vue({
            el:'#demo',
			data:{
				isHot:true,
			},
            methods: {
                changeWeather(){
                    this.isHot=!this.isHot
                }
            },
            computed: {
                info(){
                    return this.isHot?'炎热':'凉爽'
                }
            },
            watch: {
                isHot:{
                    handler(newValue,oldValue){
                console.log(newValue,oldValue)
                    }
                }
            }
        })
    </script>
</html>